﻿using Engine.Graphics;
using Game;
using GameEntitySystem;

namespace WaterWaves
{
    public class Program:ModLoader
    {
        public SubsystemTimeOfDay TimeOfDay;
        public override void __ModInitialize()
        {
            ModsManager.RegisterHook("OnEntityAdd", this);
            ModsManager.RegisterHook("SetShaderParameter", this);
        }
        public override void OnEntityAdd(Entity entity)
        {
            if (TimeOfDay == null) {
                TimeOfDay=entity.Project.FindSubsystem<SubsystemTimeOfDay>();
            }
        }
        public override void SetShaderParameter(Shader shader)
        {
            if (shader is TransparentShader) {
                shader.GetParameter("u_time").SetValue(TimeOfDay.TimeOfDay);
            }
        }

    }
}
